package com.hle;


import com.hle.tools.Asserts;
import com.hle.tools.Integers;
import com.hle.union.GenericUnionFind;
import com.hle.union.UnionFind;
import com.hle.union.UnionFind_QF;
import com.hle.union.UnionFind_QU;
import com.hle.union.UnionFind_QU_R;
import com.hle.union.UnionFind_QU_R_PC;
import com.hle.union.UnionFind_QU_R_PF;
import com.hle.union.UnionFind_QU_R_PS;
import com.hle.union.UnionFind_QU_S;

public class Main {

	public static void main(String[] args) {
//		test1(new UnionFind_QU_R_PF(12));
		test2();
	}	
	
	public static void test2() {
		GenericUnionFind<Student> uf = new GenericUnionFind<>();
		Student stu1 = new Student(1, "jack");
		Student stu2 = new Student(2, "rose");
		Student stu3 = new Student(3, "jack");
		Student stu4 = new Student(4, "rose");
		uf.makeSet(stu1);
		uf.makeSet(stu2);
		uf.makeSet(stu3);
		uf.makeSet(stu4);
		
		uf.union(stu1, stu2);
		uf.union(stu3, stu4);
		
		uf.union(stu1, stu4);
		
		Asserts.test(uf.isSame(stu2, stu3));
		Asserts.test(uf.isSame(stu3, stu4));
		Asserts.test(uf.isSame(stu1, stu3));
	}
	
	public static void test1(UnionFind uf) {
		uf.union(4, 0);
		uf.union(1, 0);
		uf.union(0, 3);
		uf.union(3, 2);
		uf.union(2, 5);
		
		uf.union(6, 7);
		
		
		uf.union(8, 9);
		uf.union(8, 10);
		uf.union(9, 10);
		uf.union(9, 11);

		
		Asserts.test(!uf.isSame(1, 6));
		Asserts.test(uf.isSame(0, 5));
		Asserts.test(uf.isSame(8, 11));
	}


}
